<?php
/**
 * Lista os setores cadastrados no banco de dados vinculados ao campus informado.
*/

if( !function_exists('__autoload') )
{
    function __autoload($class_name) {
    require_once $class_name . '.php';
    }
}

SAEO::ValidarAcesso( array( 0, 2 ) );

$ano = new Ano();
$anos = $ano->CarregarAnos(); 
?>
<html>
           <head>
           <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
           <title>SAEO - Listar Fontes</title>
           <script type='text/javascript' src='templates/programa.js'></script>
           <script type='text/javascript' src='templates/fonte.js'></script>
           <script type='text/javascript' src='templates/hintbox.js'></script>
           <script type='text/javascript' src='templates/js.js'></script>
           <script type='text/javascript' src='templates/ajax.js'></script>
           <script type='text/javascript' src='templates/validacoes.js'></script>
           <link rel='stylesheet' type='text/css' href='templates/estilos.css'/>

           </head>
     <body class='body'>
     <table width='779' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
            <tr>
                <td colspan='2'>
                	<?php include "Topo.php"; ?>
                </td>
            </tr>
            <tr>
                <td><div class='titulosTabelas' style='width:779; height:20; background:url(templates/tabela.jpg)'>LISTA DE FONTES</div></td>
            </tr>
            <tr>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td><table class='tabela' width='650' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
                           <tr>
                               <td colspan='2'>&nbsp;</td>
                           </tr>
                           <tr>
                               <td class='textoTabelas' width='20%'>&nbsp;Ano:</td>
                               <td class='textoTabelas'>
                                   <select name='anoId' id='anoId' class='inputTexto'  onchange='EsconderDiv(getElementById("informacaoFonte")); CarregarProgramas( this.value );' >
                                           <option value='0'>Selecione o Ano</option>
                                           <?php 
		                                   # percorre o array de anos criando elementos opcoes para o elemento select
		                                   for( $i = 0; $i < count( $anos ) ; $i++ )
												echo " <option value='".$anos[$i]->id."'>".$anos[$i]->ano."</option> ";
		                                   ?>
                                   </select>
                                   <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaAno ?>'>[?]</a>
                               </td>
                           </tr>
                           <tr>
                               <td colspan='2'>&nbsp;</td>
                           </tr>
                           <tr>
                               <td class='textoTabelas'>&nbsp;A&ccedil;&atilde;o Or&ccedil;ament&aacute;ria: </td>
                               <td class='textoTabelas'>
                               <select name='programas' id='listaProgramas' class='inputTexto' onchange='MostrarDiv ( this.value, getElementById("informacaoFonte")); CarregarListaFontes(this.value);' style="width: 300px;">
                                       <option id='programa' value='0'>Primeiro selecione primeiro o Ano</option>
                               </select>
                               <a href='#' class='hintanchor' onMouseover='<?php echo $ajudaPrograma ?>'>[?]</a>
                               </td>
                           </tr>
                           <tr>
                               <td colspan='2'>&nbsp;</td>
                           </tr>
                            <tr>
                               <td colspan='2'>
                                   <div id='informacaoFonte' style='display:none;'>
                                        <table id='dadosFornecedor' width='650' border='0' cellpadding='0' align='center' bgcolor='#FFFFFF' class='detalhamento'>
                                               <thead class='detalhamento'>
                                                      <tr>
                                                          <th>Fonte de Recurso</th>
                                                          <th>Tipo de Despesa</th>
                                                          <th>Valor</th>
                                                      </tr>
                                               </thead>
                                               <tbody class='detalhamento' id='corpoFonte'>
                                               </tbody>
                                        </table>
                                   </div>
                               </td>
                           </tr>
                           <tr>
                               <td colspan='2'>&nbsp;</td>
                           </tr>
                     </table>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
            </tr>
            <tfoot>
                   <tr>
                       <?php include 'rodapeCreditos.php'; ?>
            		</tr>
            </tfoot>
     </table>
     </body>
     </html>